package org.jeecg.modules.app.enums;

import org.jeecg.common.annotation.EnumDict;
import org.jeecg.common.enums.IEnumDict;
import org.jeecg.common.exception.JeecgBootException;

@EnumDict(code ="app_platform_type_dict", name = "APP平台类型")
public enum AppPlatformTypeEnums implements IEnumDict<AppPlatformTypeEnums> {

    ANDROID("1", "安卓系统", "android", "enums.appplatformtype.android"),

    IOS("2", "苹果系统", "ios", "enums.appplatformtype.ios");

    private String value;

    private String label;

    private String key;
    /**
     * 多语言key
     */
    private String remark;

    AppPlatformTypeEnums(String value, String label, String key, String remark) {
        this.value = value;
        this.label = label;
        this.key = key;
        this.remark = remark;
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    public String getLabel() {
        return label;
    }

    @Override
    public String getKey() {
        return key;
    }

    public String getRemark() {
        return remark;
    }

    public static AppPlatformTypeEnums getEnumByValue(String value){
        for(AppPlatformTypeEnums item: values()){
            if(value.equals(item.value)){
                return item;
            }
        }
        return null;
    }

    public static AppPlatformTypeEnums getEnumByKey(String key){
        for(AppPlatformTypeEnums item: values()){
            if(key.equals(item.key)){
                return item;
            }
        }
        throw new JeecgBootException("没找到对应字典");
    }

}
